import {get, post } from '../../utils/request'
const state = {
    //用来保存查询出来的栏目信息
    customers: [],
    total: 0
}
const actions = {
    findAllCustomer(context, list) {
        //异步操作
        get('/account/pageQueryCustomerAccount', list).then(res => {
            console.log(res.data);
            let response = res.data.list
            context.commit('setCustomers', response)
            let total = res.data.total
            context.commit('setTotal', total)
        })
    },

    // //保存栏目信息
    // saveProduct(context, list) {
    //     let response = post('/product/saveOrUpdate', list)
    //     return response
    // },
    // //下架栏目信息
    // deleteProduct(context, list) {
    //     let response = get('/product/offline', list)
    //     return response
    // }
}
const mutations = {
    //修改state中的值
    setCustomers(state, response) {
        state.customers = response
    },
    setTotal(state, total) {
        state.total = total
    }
}
export default {
    namespaced: true,
    state,
    actions,
    mutations
}